import request from "@/utils/request";

/**
 * 用户登录
 * @param {*} data 数据
 * @returns
 */
export function login(data) {
  return request({
    url: "/user/login",
    method: "post",
    params: data,
  });
}

/**
 * 获取用户信息
 * @param {*} id 用户ID
 * @returns
 */
export function getInfo(id) {
  return request({
    url: "/user/one",
    method: "get",
    params: {id},
  });
}

/**
 * 分页查询用户
 * @param {*} current 页码
 * @param {*} page 页长
 * @param {*} wx.getUserInfo() 条件
 */
export function getUserTable(current, size, user) {
  return request({
    url: "/user",
    method: "get",
    params: {
      current: current,
      size: size,
      user,
    },
  });
}

export function logout() {
  return request({
    url: "/vue-admin-template/user/logout",
    method: "post",
  });
}
